﻿<%@ Page Title="Alocar Usuário X Estados" Language="C#" MasterPageFile="~/Site.Master"
    AutoEventWireup="true" CodeBehind="AlocarUsuarioXEstados.aspx.cs" Inherits="AcadPosApp.Cadastros.AlocarUsuarioXEstados" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <style type="text/css">
        .style3
        {
            width: 109px;
        }
        .style4
        {
            width: 143px;
        }
        .style5
        {
            width: 114px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="pnlConsulta" runat="server" GroupingText="Consulta">
        <table class="form-inline">
            <tr>
                <td class="style3">
                    <asp:Label ID="Label2" runat="server" Text="Tipo Pesquisa"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlTpPesquisa" runat="server" Width="100px" Height="30px" AutoPostBack="True"
                        OnSelectedIndexChanged="ddlTpPesquisa_SelectedIndexChanged">
                        <asp:ListItem Value="n">Nome</asp:ListItem>
                        <asp:ListItem Value="c">Código</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td class="style4">
                    <asp:RegularExpressionValidator ID="revNumeros" runat="server" ControlToValidate="TxtPesquisa"
                        ErrorMessage="Para pesquisar por código, digite apenas números." ForeColor="Red"
                        ValidationExpression="^\d*$" ValidationGroup="pesquisa" SetFocusOnError="True"
                        Visible="False">*</asp:RegularExpressionValidator>
                    <asp:RegularExpressionValidator ID="somenteLetras" runat="server" ControlToValidate="TxtPesquisa"
                        ErrorMessage="Para pesquisar por nome, digite apenas letras." ForeColor="Red"
                        ValidationExpression="([\s\'\.\^\~\´\`\\áÁ\\àÀ\\ãÃ\\âÂ\\éÉ\\èÈ\\êÊ\\íÍ\\ìÌ\\óÓ\\òÒ\\õÕ\\ôÔ\\úÚ\\ùÙ\\çÇaA-zZ]+)"
                        ValidationGroup="pesquisa" SetFocusOnError="True">*</asp:RegularExpressionValidator>
                    <br />
                    <asp:TextBox ID="TxtPesquisa" runat="server" Height="30px" required="" 
                        Width="250px"></asp:TextBox>
                </td>
                <td class="style5">
                    <br />
                    &nbsp;
                    <asp:Button ID="btnConsultar" runat="server" Text="Consultar" OnClick="btnConsultar_Click"
                        ValidationGroup="pesquisa" Width="100px" />
                </td>
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvwPesquisa" runat="server" AutoGenerateColumns="False" CssClass="mGrid"
            DataKeyNames="ID_USUARIO" EmptyDataText="Dados não localizados..." GridLines="Vertical"
            Width="95%" OnRowDataBound="gvwPesquisa_RowDataBound" OnSelectedIndexChanged="gvwPesquisa_SelectedIndexChanged"
            AllowPaging="True" OnPageIndexChanging="gvwPesquisa_PageIndexChanging">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:CommandField ButtonType="Image" SelectImageUrl="~/Imagens/select.png" ShowSelectButton="True" />
                <asp:BoundField DataField="NOME" HeaderText="Nome">
                    <ItemStyle HorizontalAlign="Left" Width="65%" />
                </asp:BoundField>
                <asp:BoundField DataField="EMAIL" HeaderText="E-mail">
                    <ItemStyle HorizontalAlign="Left" Width="15%" />
                </asp:BoundField>
                <asp:BoundField DataField="LOTACAO" HeaderText="Lotação">
                    <ItemStyle HorizontalAlign="Center" Width="10%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="SITUACAO" HeaderText="Status">
                    <ItemStyle HorizontalAlign="Center" Width="10%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <div class="legenda">
            <table class="form-inline">
                <tr>
                    <td class="style6" colspan="2">
                        Legenda
                    </td>
                </tr>
                <tr>
                    <td class="style9">
                        Ativo&nbsp; :
                    </td>
                    <td>
                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Imagens/ativo.png" Width="25px" />
                    </td>
                </tr>
                <tr>
                    <td class="style9">
                        Inativo:
                    </td>
                    <td>
                        <asp:Image ID="Image2" runat="server" ImageUrl="~/Imagens/inativo.png" Width="25px" />
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>
    <br />
    <asp:Panel ID="pnlEstados" runat="server" GroupingText="Estados X Usuário" Visible="False">
        <asp:GridView ID="gvwEstadosAlocados" runat="server" AutoGenerateColumns="False"
            CssClass="mGrid" DataKeyNames="ID_USUARIO_ESTADO" EmptyDataText="Dados não localizados..."
            GridLines="Vertical" Width="95%" OnRowCreated="gvwEstadosAlocados_RowCreated"
            OnRowDataBound="gvwEstadosAlocados_RowDataBound" 
            OnRowCommand="gvwEstadosAlocados_RowCommand" AllowPaging="True" 
            onpageindexchanging="gvwEstadosAlocados_PageIndexChanging">
            <AlternatingRowStyle BackColor="#D3D3D3" />
            <Columns>
                <asp:TemplateField HeaderText="Excluir" ShowHeader="False">
                    <ItemTemplate>
                        <abbr title="Excluir usuário!">
                            <asp:ImageButton ID="ImgExcluir" runat="server" CausesValidation="false" CommandName="Excluir"
                                formnovalidate="formnovalidate" ImageUrl="~/Imagens/delete.png" OnClientClick="return ShowConfirm('Tem certeza que deseja excluir?', this.ID);"
                                Text="Excluir" Width="20px" />
                        </abbr>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" Width="1%" />
                    <ItemStyle HorizontalAlign="Center" Width="1%" />
                </asp:TemplateField>
                <asp:BoundField DataField="UF" HeaderText="Estado">
                    <ItemStyle HorizontalAlign="Left" Width="90%" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Image ID="imgStatus" runat="server" Height="25px" Width="25px" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="SITUACAO" HeaderText="Status">
                    <ItemStyle HorizontalAlign="Center" Width="10%" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
            <PagerStyle CssClass="pagination" ForeColor="Black" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#1E90FF" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#808080" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#383838" />
        </asp:GridView>
        <br />
        <div class="legenda">
            <asp:Button ID="btnNovo" runat="server" CssClass="btn btn-inverse" OnClick="btnNovo_Click"
                Text="Novo" Width="80px" />
        </div>
        <br />
    </asp:Panel>
    <br />
    <asp:Panel ID="pnlCadastroEstado" runat="server" GroupingText="Cadastro" Visible="False">
        <table class="style1">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="Estado"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlUF" runat="server" Width="70px">
                        <asp:ListItem Value="AC">AC</asp:ListItem>
                        <asp:ListItem Value="AL">AL</asp:ListItem>
                        <asp:ListItem Value="AM">AM</asp:ListItem>
                        <asp:ListItem Value="AP">AP</asp:ListItem>
                        <asp:ListItem Value="BA">BA</asp:ListItem>
                        <asp:ListItem Value="CE">CE</asp:ListItem>
                        <asp:ListItem Value="DF">DF</asp:ListItem>
                        <asp:ListItem Value="ES">ES</asp:ListItem>
                        <asp:ListItem Value="GO">GO</asp:ListItem>
                        <asp:ListItem Value="MA">MA</asp:ListItem>
                        <asp:ListItem Value="MG">MG</asp:ListItem>
                        <asp:ListItem Value="MS">MS</asp:ListItem>
                        <asp:ListItem Value="MT">MT</asp:ListItem>
                        <asp:ListItem Value="PA">PA</asp:ListItem>
                        <asp:ListItem Value="PB">PB</asp:ListItem>
                        <asp:ListItem Value="PE">PE</asp:ListItem>
                        <asp:ListItem Value="PI">PI</asp:ListItem>
                        <asp:ListItem Value="PR">PR</asp:ListItem>
                        <asp:ListItem Value="RJ">RJ</asp:ListItem>
                        <asp:ListItem Value="RN">RN</asp:ListItem>
                        <asp:ListItem Value="RO">RO</asp:ListItem>
                        <asp:ListItem Value="RR">RR</asp:ListItem>
                        <asp:ListItem Value="RS">RS</asp:ListItem>
                        <asp:ListItem Value="SC">SC</asp:ListItem>
                        <asp:ListItem Selected="True" Value="SE">SE</asp:ListItem>
                        <asp:ListItem Value="SP">SP</asp:ListItem>
                        <asp:ListItem Value="TO">TO</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Situação"></asp:Label>
                    <br />
                    <asp:DropDownList ID="ddlSituacao" runat="server">
                        <asp:ListItem Value="A">Ativo</asp:ListItem>
                        <asp:ListItem Value="I">Inativo</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <br />
        <div class="legenda">
            <asp:Button ID="btnConfirmar" runat="server" CssClass="btn btn-inverse" OnClick="btnConfirmar_Click"
                Text="Confirmar" Width="80px" />
            <asp:Button ID="btnCancelar" runat="server" CssClass="btn btn-inverse" OnClick="btnCancelar_Click"
                Text="Cancelar" Width="80px" />
        </div>
    </asp:Panel>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
        ShowSummary="False" ValidationGroup="pesquisa" />
</asp:Content>
